home *** CD-ROM | disk | FTP | other *** search
/ Aminet 6 / Aminet 6 - June 1995.iso / Aminet / text / hyper / ADtoHT2_0.lha / MyLib.lha / startup / startup_GNUC.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-03-21  |  868 b   |  67 lines

  1. /* Startup module for GNU C                    */
  2. /* I've put this into a C file so I can use the preprocessor.    */
  3.  
  4. #if !defined(__GNUC__)
  5. #error This file is for GNU C *only*
  6. #elif !defined(mc68000)
  7. #error This file is for m68k systems *only*
  8. #else
  9.  
  10. asm(
  11. #ifdef SMALL_DATA
  12. "    jbsr __geta4
  13.     lea a4@(__edata:W),a0
  14. "
  15. #else
  16. "    lea __edata,a0
  17. "
  18. #endif
  19. "    movl #___bss_size,d0
  20.     jeq ClearBSSDone
  21. ClearBSSLoop:
  22.     clrl a0@+
  23.     subql #4,d0
  24.     jne ClearBSSLoop
  25. ClearBSSDone:
  26. "
  27. #ifdef SMALL_DATA
  28. "    movl SP,a4@(StackPointer:W)
  29. "
  30. #else
  31. "    movl SP,StackPointer
  32. "
  33. #endif
  34. #ifdef SMALL_CODE
  35. "    jra PC@(__Startup+2)
  36. "
  37. #else
  38. "    jmp __Startup
  39. "
  40. #endif
  41. "    .globl ___exit
  42. ___exit:
  43.     movl SP@(4),d0
  44. "
  45. #ifdef SMALL_DATA
  46. "    movl a4@(StackPointer:W),SP
  47. "
  48. #else
  49. "    movl StackPointer,SP
  50. "
  51. #endif
  52. "    .globl __geta4
  53. __geta4:
  54. "
  55. #ifdef SMALL_DATA
  56. "    lea ___a4_init,a4
  57. "
  58. #endif
  59. "    rts
  60.  
  61.     .data
  62.     .comm StackPointer,4
  63.     .text
  64. ");
  65.  
  66. #endif
  67.